<template>
	<view>
		<view v-if="video.type">
		<video id="myVideo" :src="video.url" @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu danmu-btn controls ob></video>
		</view>
			<view class="pay_video" v-else>
				<view class="btn">
					该视频需要购买{{video.charge}}
				</view>
			</view>
</view>
</template>

<script>
	export default {
		name:"video",
		props:{
			video:{
				type:Object,
				required:true
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			//视频播放出错时执行
			videoErrorCallback: function(e) {
				uni.showModal({
					content: e.target.errMsg,
					showCancel: false
				})
			},
		}
	}
</script>

<style lang="less">
video{
	width: 100%;
}
.pay_video{
	height: 225px;
	background-color: #000;
	display: flex;
	justify-content: center;
	align-items: center;
	.btn{
		padding:40rpx 100rpx;
		color: #fff;
		border-radius: 100rpx;
		background-color: #5d8ced;
	}
}
</style>
